<template>
  <div class="history">
    <div class="history_left">
      <router-link to="/history">
        <div class="history_btn btn_l">
          历史消耗查询
        </div>
      </router-link>
      <div class="pilotLamp">
        <div v-for="item in lineStatus" :key="item.name" class="p_list">
          <span>{{ item.name }}</span>
          <span v-show="item.value" style="background-color:green"></span>
          <span v-show="!item.value" style="background-color:red"></span>
        </div>
      </div>
      <div>
      </div>
    </div>
    <div class="history_right">
      <router-link to="/history/abnormal">
        <div class="history_btn btn_r">历史异常消耗查询</div>
      </router-link>
      <span>Powered by TEF4</span>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      "lineStatus": [
        // {
        //   'name':'1',
        //   'value':1
        // },
        // {
        //   'name':'2',
        //   'value':0
        // }
      ]
    };
  },
  created() {
  },
  components: {},
  mounted() {
    this.getProductLineStatus()
    this.refreshData = window.setInterval(() => {
      setTimeout(this.getProductLineStatus, 0)
    }, 10000)
  },
  methods: {
    getProductLineStatus() {
      this.$http.get("/opc/device/line_status").then(res => {
        if (res.data.code === 0) {
          this.lineStatus = res.data.data
          // console.log(this.lineStatus)
        }
      })

    },
  }
};
</script>
